package com.cn.study0014.test003;

/**
 * @author lw
 * @ClassName customerBiz.java
 * @Description
 * @createTime 2023年05月18日 14:39:00
 */
public class CustomerBiz {
    String[] customer=new String[10];
    int i=0;

    /**
     * 添加客户
     * @param name
     */
    public void addName(String name){
        if (customer[i]==null){
            customer[i]=name;
        }
        i++;
    }

    /**
     * 显示客户名
     */
    public void showName(){
        System.out.println("**************************");
        System.out.println("\t\t客户姓名列表");
        System.out.println("**************************");
        for (int j = 0; j < customer.length ; j++) {
            if (customer[j]!=null){
                System.out.print(customer[j]+"\t\t");
            }
        }
    }



    public boolean editName(String oldName,String newName){
        boolean find=false;
        for (int j = 0; j < customer.length; j++) {
            if (customer[j].equals(oldName)){
                customer[j]=newName;
                find=true;
                break;
            }
        }
        return find;
    }
}
